package com.caishi.lkx.exam.question;

import cn.hutool.core.collection.CollUtil;
import com.caishi.lkx.exam.model.QuestionModel;


import java.util.List;
import java.util.Map;

/**
 * 简答题
 */
public class TextDataProcess extends FillDataProcess {

    @Override
    protected double computedAnswerQualityLevel(QuestionModel questionModel) {
        //答案(5)： 解答题结构化有答案2分，结构化无答案5分，非结构化都是0分，
        List<Map<String, Object>> answers = questionModel.getQuOption();
        if (CollUtil.isNotEmpty(answers)) {
            Map<String, Object> data = answers.get(0);
            List<?> pts = (List) data.get("pt");
            if (pts != null && pts.isEmpty()) {
                // 结构化无答案5分
                return 5;
            } else if (CollUtil.isNotEmpty(pts)) {
                // 结构化有答案2分
                return 2;
            }
        }
        return 0;
    }
}
